package com.ypbase.cloud.tags.dao.common;

import java.io.Serializable;

import com.cloud.framework.core.dal.entity.MyBaseEntity;
import com.cloud.framework.core.dal.repo.datajpa.BaseRepository;
import com.cloud.framework.core.service.BaseServiceImpl;


/**
 * Base Dao Service
 *
 * @param <D>
 *            the repository
 * @param <T>
 *            the model
 * @param <ID>
 *            the model id
 */
public class BaseDaoService<D extends BaseRepository<T, ID>, T extends MyBaseEntity<ID>, ID extends Serializable>
        extends BaseServiceImpl<D, T, ID> {

	/**
	 * constructor
	 *
	 * @param repository
	 */
	public BaseDaoService(D repository) {
		super(repository);
	}

	/**
	 * update and flush
	 *
	 * @param entity
	 * @return the entity
	 */
	public T updateAndFlush(T entity) {
		T result = update(entity);
		flush();
		return result;
	}

}
